package com.kc.business.service.impl;

import com.kc.business.domain.BizVideo;
import com.kc.business.mapper.BizVideoMapper;
import com.kc.business.service.IBizVideoSeivice;
import com.kc.system.service.ISysDictDataService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 视频管理service 实现类
 */
@Service
public class BizVideoServiceImpl implements IBizVideoSeivice {
    @Resource
    private BizVideoMapper bizVideoMapper;
    @Resource
    private ISysDictDataService dictDataService;
    /**
     * 获取视频列表
     * @return
     */
    @Override
    public List<BizVideo> getList(BizVideo bizVideo) {
        //处理字典数据
        List<BizVideo> bizVideoList = bizVideoMapper.select(bizVideo);
        bizVideoList.forEach(bizVideo1 -> {
            String videoTypeName = dictDataService.selectDictLabel("video_type",bizVideo1.getVideoType());
            bizVideo1.setVideoTypeName(videoTypeName);
        });
        return bizVideoList;
    }

    /**
     * 获取详情
     * @param bizVideo
     * @return
     */
    @Override
    public BizVideo getInfo(BizVideo bizVideo) {
        return bizVideoMapper.selectByPrimaryKey(bizVideo);
    }

    /**
     * 新增
     * @param bizVideo
     * @return
     */
    @Override
    public Integer add(BizVideo bizVideo) {
        return bizVideoMapper.insert(bizVideo);
    }
    /**
     * 修改
     * @param bizVideo
     * @return
     */
    @Override
    public Integer edit(BizVideo bizVideo) {
        return bizVideoMapper.updateByPrimaryKey(bizVideo);
    }
    /**
     * 删除
     * @param bizVideo
     * @return
     */
    @Override
    public Integer remove(BizVideo bizVideo) {
        return bizVideoMapper.updateByPrimaryKey(bizVideo);
    }
}
